package com.qiguliuxing.dts.core.util;


/**
 * RedisKey
 */
public class RedisKeyUtils {
    //主数据系统标识
    public static final String KEY_PREFIX = "dts";

    //分割字符，默认[:]，使用:可用于rdm分组查看
    private static final String KEY_SPLIT_CHAR = ":";

    /**
     * 用户的tokenMapKey
     * @param token：用户的token
     */
    public static String getTokenMapKey(String token){
        return KEY_PREFIX + KEY_SPLIT_CHAR + "token" + KEY_SPLIT_CHAR + token;
    }

    /**
     * 用户的idMapKey
     * @param id：用户的id
     */
    public static String getIdMapKey(Integer id){
        return KEY_PREFIX + KEY_SPLIT_CHAR + "uid" + KEY_SPLIT_CHAR + id.toString();
    }

    /**
     * 验证码的Key
     */
    public static String getCaptchaCodeKey(String phoneNumber){
        return KEY_PREFIX + KEY_SPLIT_CHAR + "captchaCode" + KEY_SPLIT_CHAR + phoneNumber;
    }


    /**
     * 缓存首页Index数据的Key
     */
    public static String getHomeIndexKey(){
        return KEY_PREFIX + KEY_SPLIT_CHAR + "home" + KEY_SPLIT_CHAR + "index";
    }

    /**
     * 缓存首页Catalog数据的Key
     */
    public static String getHomeCatalogKey(){
        return KEY_PREFIX + KEY_SPLIT_CHAR + "home" + KEY_SPLIT_CHAR + "catalog";
    }

    /**
     * 缓存首页Goods数据的Key
     */
    public static String getHomeGoodsKey(){
        return KEY_PREFIX + KEY_SPLIT_CHAR + "home" + KEY_SPLIT_CHAR + "goods";
    }
}

